import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.IOException;

import javax.swing.Timer;

import game.*;
import game.view.GameUI;

/**
 * Main class.
 * @author Natchanon Hongladaromp
 *
 */
public class Main {
	
	/**
	 * Main method.
	 * @param args command line agruments
	 * @throws IOException
	 */
	public static void main(String[] args) throws IOException
	{		
		final Game game = new Game();
		
		GameUI g = new GameUI(game);
		game.addObserver(g);
		g.run();
		
		ActionListener task = new ActionListener()
		{
			public void actionPerformed(ActionEvent evt)
			{
				game.updateTime();
			}
		};
		
		
		Timer timer = new Timer(10,task);
		timer.start();
		
	}
}
